<?php

/**
 * This is the model class for table "ShipToAddress".
 *
 * The followings are the available columns in table 'ShipToAddress':
 * @property integer $ID
 * @property string $Code
 * @property string $ShipToCode
 * @property string $Rel_Cus
 * @property string $SameasBillTo
 * @property string $Blind
 * @property string $Company
 * @property string $Contact
 * @property string $Address
 * @property string $City
 * @property string $State
 * @property string $Zip
 * @property string $Country
 * @property string $Phone1
 * @property string $Phone2
 * @property string $Login
 * @property string $Modifier
 * @property string $CreateTime
 * @property string $UpdateTime
 * @property string $Notes
 */
class ShipToAddress extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return ShipToAddress the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'ShipToAddress';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('Code, ShipToCode, Rel_Cus, Contact, City, State, Zip, Country, Phone1, Phone2, Login, Modifier, CreateTime, UpdateTime', 'length', 'max'=>50),
			array('SameasBillTo, Blind', 'length', 'max'=>100),
			array('Company', 'length', 'max'=>200),
			array('Address', 'length', 'max'=>250),
			array('Notes', 'length', 'max'=>1073741823),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('ID, Code, ShipToCode, Rel_Cus, SameasBillTo, Blind, Company, Contact, Address, City, State, Zip, Country, Phone1, Phone2, Login, Modifier, CreateTime, UpdateTime, Notes', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'ID' => 'ID',
			'Code' => 'Code',
			'ShipToCode' => 'Ship To Code',
			'Rel_Cus' => 'Rel Cus',
			'SameasBillTo' => 'Sameas Bill To',
			'Blind' => 'Blind',
			'Company' => 'Company',
			'Contact' => 'Contact',
			'Address' => 'Address',
			'City' => 'City',
			'State' => 'State',
			'Zip' => 'Zip',
			'Country' => 'Country',
			'Phone1' => 'Phone1',
			'Phone2' => 'Phone2',
			'Login' => 'Login',
			'Modifier' => 'Modifier',
			'CreateTime' => 'Create Time',
			'UpdateTime' => 'Update Time',
			'Notes' => 'Notes',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('ID',$this->ID);
		$criteria->compare('Code',$this->Code,true);
		$criteria->compare('ShipToCode',$this->ShipToCode,true);
		$criteria->compare('Rel_Cus',$this->Rel_Cus,true);
		$criteria->compare('SameasBillTo',$this->SameasBillTo,true);
		$criteria->compare('Blind',$this->Blind,true);
		$criteria->compare('Company',$this->Company,true);
		$criteria->compare('Contact',$this->Contact,true);
		$criteria->compare('Address',$this->Address,true);
		$criteria->compare('City',$this->City,true);
		$criteria->compare('State',$this->State,true);
		$criteria->compare('Zip',$this->Zip,true);
		$criteria->compare('Country',$this->Country,true);
		$criteria->compare('Phone1',$this->Phone1,true);
		$criteria->compare('Phone2',$this->Phone2,true);
		$criteria->compare('Login',$this->Login,true);
		$criteria->compare('Modifier',$this->Modifier,true);
		$criteria->compare('CreateTime',$this->CreateTime,true);
		$criteria->compare('UpdateTime',$this->UpdateTime,true);
		$criteria->compare('Notes',$this->Notes,true);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}